import request from "@/utils/request";

// 查询数据角色功能授权列表
export function listPower(query: any) {
    return request({
        url: "/system/power/list",
        method: "get",
        params: query,
    });
}

// 查询数据角色功能授权详细
export function getPower(rmpId: number) {
    return request({
        url: "/system/power/" + rmpId,
        method: "get",
    });
}

// 新增数据角色功能授权
export function addPower(data: any) {
    return request({
        url: "/system/power",
        method: "post",
        data: data,
    });
}
// 新增数据角色功能授权(批量菜单)
export function addPowerMenuIds(data: any) {
    return request({
        url: "/system/power/saveMenuIds",
        method: "post",
        data: data,
    });
}

// 修改数据角色功能授权
export function updatePower(data: any) {
    return request({
        url: "/system/power",
        method: "put",
        data: data,
    });
}

// 修改数据角色功能授权(批量菜单)
export function updatePowerMenuIds(data: any) {
    return request({
        url: "/system/power/modifyMenuIds",
        method: "put",
        data: data,
    });
}

// 删除数据角色功能授权
export function delPower(rmpId: string) {
    return request({
        url: "/system/power/" + rmpId,
        method: "delete",
    });
}

// 状态修改
export function changeRoleStatus(rmpId: any, status: any) {
    const data = {
        rmpId,
        status,
    };
    return request({
        url: "/system/power/changeStatus",
        method: "put",
        data: data,
    });
}
